package Test;

import java.util.Map;

public class Tast {
    public static void main(String[] args) {
        int[] nums = {1,3,4,6,7,9,10,12};
        int n = nums.length;
        int[] f = new int[n];
        int[] g = new int[n];
        //1.处理一下边界情况
        f[0] = g[n - 1] = 1;
        //2.预设一个前缀积数组
        for (int i = 1; i < n; i++) {
            f[i] = f[i - 1] * nums[n - 1];
        }
        for (int i = n - 2; i >= 0; i--) {
            g[i] = g[i +1] * nums[i+1];
        }
        //3.使用前缀积数组
        int[] ret = new int[n];
        for (int i = 0; i < n; i++) {
            ret[i] = f[i] * g[i];

        }
        System.out.println(ret);


    }
}
